import socket
import select
import time
import myserver

class ServerSelect(myserver.Server):
    """docstring for ServerSelect"""
    def __init__(self,):
        super(ServerSelect, self).__init__()
        self.wlist = [] #select函数的参数
        self.elist = [] #select函数的参数
    
    def main(self):
        while True :
            readable_sockets, writable_sockets, error_sockets = select.select(
                self.socket_list, self.wlist, self.elist)
            for s in readable_sockets:
                if s is self.listenfd:
                    conn, addr = self.listenfd.accept()  # conn为已连接描述符
                    self.new_member(conn,addr)
                else:
                    if not self.communicateWith(s) :
                        break


if __name__ == '__main__':
    ServerSelect().main()
